import { FormItemRule, MessageApi } from 'naive-ui'
import { Ref, VNode } from 'vue'

export interface FormItem {
  key: string | number
  label: string
  value: Ref
  required?: boolean
  validator?: (value: FormItem, message: MessageApi) => boolean
  naiveValidator?: (rule: FormItemRule, value: any) => boolean | Error
  maxLength?: number
  disabled?: Ref<boolean>
  path?: string
  optionList?: Ref // ! 不建议再使用了
  message?: string
  trigger?: string | string[]
  navie?: boolean
  reset?: (formItem: FormItem) => void
  beforeRender?: (formItem: FormItem) => Promise<any> // ! 不建议再使用了
  render?: (formItem: FormItem) => VNode
}
export interface SelectOptionItem {
  label: string
  value: any
}
